import router from "@/plugins/router"

export default class BalaBala {
  public static info(msg: string, okLabel?: string) {
    // @ts-ignore
    return MuseUIMessage.confirm(msg, '提示', {
      type: 'info',
      okLabel: okLabel || '确定'
    })
  }

  public static warning(msg: string, okLabel?: string) {
    // @ts-ignore
    return MuseUIMessage.confirm(msg, '警告', {
      type: 'warning',
      okLabel: okLabel || '确定'
    })
  }

  public static error(msg: string) {
    // @ts-ignore
    return MuseUIMessage.alert(msg, '错误', {
        type: 'error'
      }
    )
  }

  public static unLoginMessage() {
    // @ts-ignore
    BalaBala.info('还未登录，请前往登录并完善信息', '登录').then(({result}) => {
      if (result) {
        router.push({name: 'login'})
      }
    })
  }

  public static systemErrorMsg() {
    BalaBala.error('系统出错')
  }

  public static unUploadImg() {
    // @ts-ignore
    BalaBala.info('请完善用户信息，上传照片', '上传').then(({result}) => {
      if (result) {
        router.push({name: 'mine'})
      }
    })
  }
}
